package com.cn.ZhiKeDianShang.util.Netdialog.Dialog.interfaces;

import android.view.View;
import android.widget.TextView;

import com.cn.ZhiKeDianShang.R;
import com.cn.ZhiKeDianShang.util.Netdialog.Dialog.Tool;
import com.cn.ZhiKeDianShang.util.Netdialog.Dialog.config.ConfigBean;
import com.cn.ZhiKeDianShang.util.Netdialog.Dialog.config.DefaultConfig;


/**
 * 这个是绘制showdilog的代码
 */
public class MyDialogBuilder {

    protected static int singleChosen;

    protected ConfigBean buildByType(ConfigBean bean) {
        Tool.fixContext(bean);
        switch (bean.type) {
            case DefaultConfig.TYPE_LOADING:
                Tool.newCustomDialog(bean);
                buildLoading(bean);
                break;
            default:
                break;
        }

        Tool.setDialogStyle(bean);
        Tool.setCancelable(bean);
        return bean;
    }


    protected ConfigBean buildLoading(ConfigBean bean) {
        View root = View.inflate(bean.context, R.layout.loading, null);
        TextView tvMsg = (TextView) root.findViewById(R.id.tv_msg);
        tvMsg.setText(bean.msg);
        bean.dialog.setContentView(root);
        return bean;
    }


}
